/**
 * 试题排重处理使用附件判断条件
 * @param scope
 * @returns {boolean}
 */
const attachmentCond = (scope) => {
    return (scope.row.questionType === '5' &&
        (scope.row.subType === '7' || scope.row.subType === '8' || scope.row.subType === '9')) ||
        (scope.row.questionType === '6' && scope.row.subType === '13')
}

const deleteRepeatCond = (scope) => {
    return scope.row.delFlag === '0' && (scope.row.createBy === '管理员' || scope.row.createBy === '杨宝莹')
}

const logicDeleteCond = (scope) => {
    return scope.row.delFlag === '0'
}

const checkDeleteRepeatCond = (scope) => {
    return scope.row.opFlag === '1'
}

/**
 * 试题排重处理判断条件
 * @param scope
 * @returns {boolean}
 */
/*const repeatCond = (scope) => {
    return scope.row.delFlag === '0' && scope.row.repeatedFlag === '0'
}*/

/**
 * 试题排重处理操作按钮定义
 * @type {[null,null,null,null,null]}
 */
const questionRepeatedBtnList = [
    {
        id: 'attachment',
        title: '附件',
        isShow: true,   // 是否显示
        isPermission: true,　 // 是否进行权限认证
        cond: attachmentCond
    },
    {
        id: 'saveRepeat',
        title: '保留试题',
        isShow: true,   // 是否显示
        isPermission: true  // 是否进行权限认证
    },
    {
        id: 'deleteRepeat',
        title: '删除试题',
        isShow: true,   // 是否显示
        isPermission: true  // 是否进行权限认证
    }
]

const questionRepeatedBtnList2 = [
    {
        id: 'attachment',
        title: '附件',
        isShow: true,   // 是否显示
        isPermission: true,　 // 是否进行权限认证
        cond: attachmentCond
    },
    {
        id: 'deleteRepeat',
        title: '删除试题',
        isShow: true,   // 是否显示
        isPermission: true,  // 是否进行权限认证
        cond: deleteRepeatCond
    }
]

/**
 * 试题检测操作按钮定义
 * @type {[null,null,null,null,null]}
 */
const questionTestingBtnList = [
    {
        id: 'attachment',
        title: '附件',
        isShow: true,   // 是否显示
        isPermission: true,　 // 是否进行权限认证
        cond: attachmentCond
    },
    {
        id: 'logicDelete',
        title: '删除',
        isShow: true,   // 是否显示
        isPermission: true,  // 是否进行权限认证
        cond: logicDeleteCond
    }
]

const repeatedCheckBtnList = [
    {
        id: 'attachment',
        title: '附件',
        isShow: true,   // 是否显示
        isPermission: true,　 // 是否进行权限认证
        cond: attachmentCond
    },
    {
        id: 'deleteRepeat',
        title: '删除试题',
        isShow: true,   // 是否显示
        isPermission: true,  // 是否进行权限认证
        cond: checkDeleteRepeatCond
    }
]

export {questionRepeatedBtnList, questionRepeatedBtnList2, questionTestingBtnList, repeatedCheckBtnList}
